const xlsx = require("node-xlsx");
const path = require("path");
const uuid = require("uuid");

const exchangeRate = require("../ExchangeRate")

// 导入提成
const exchangeRateData = xlsx.parse(path.join( __dirname, "..", "..", "xlsx", "exchangeRate.xlsx" ))[0].data;
const arr = [];
for(let i=1; i<exchangeRateData.length; i++){
  arr.push({
    eId: 'exchangeRate-'+uuid.v1(),
    currency: exchangeRateData[i][0],
    exchangeRate: exchangeRateData[i][1]-0
  })
}
exchangeRate.insertMany( arr ).then(()=>{
  console.log('提成导入成功');
})